package com.casa.POI.dianping;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

public class CompositeExecutor extends Executor {

	private List<Executor> executors = new ArrayList<Executor>();

	@Override
	public String getPromptString() {
		return null;
	}

	@Override
	public void execute() {
		for (Executor executor : getExecutors()) {
			if (executor.getPromptString() != null)
				Console.newLineWriteLine(executor.getPromptString());
			executor.execute();
			Console.writeLine(StringUtils.EMPTY);
		}
	}

	public CompositeExecutor addExecutor(Executor executor) {
		this.getExecutors().add(executor);
		return this;
	}

	public List<Executor> getExecutors() {
		return executors;
	}
}
